<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然企业级管理平台</title>
  <meta charset="utf-8">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">编辑接口文档生成配置信息</li>
            </ol>
          </div>
        </div>
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="pull-right h-btn-group">
              <button class="btn btn-info" id="return-btn" onclick="returnIndex()"><i class="fa fa-mail-reply">&nbsp;&nbsp;</i>返回
              </button>
              <@permission btnType="save" btnId="saveBtn" btnValue="保存" op="api:facadeGenerateConfig:save"
              btnMethod="ApiFacadeGenerateConfigMgr.submitForm()"/>
              <@permission btnType="generateDoc" btnId="saveBtn" btnValue="生成接口Excel文档" op="api:facadeExcel:save"
              btnMethod="ApiFacadeExcelMgr.submitForm()"/>
            </div>
          </form>
        </div>

        <div class="form-horizontal  h-form-warp">
          <div class="h-msg-title h-table-header">
            <strong>接口文档生成配置信息</strong>
          </div>
          <form id="apiFacadeGenerateConfigForm" role="form" class="form-horizontal"
                action="/apiFacadeGenerateConfig/saveApiFacadeGenerateConfig" method="post">
            <input type="hidden" id="operation" name="operation" value="${operation}"/>
            <input type="hidden" class="form-control" value="${apiFacadeGenerateConfig.id!}" id="id" name="id">
            <div class="form-group">
              <label class="col-sm-2 control-label">项目编码 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.projectCode!}" id="projectCode"
                       name="projectCode"
                       required="required" number="true" maxlength='64'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">项目名称 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.projectName!}" id="projectName"
                       name="projectName"
                       required="required" number="true" maxlength='128'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">class文件所在路径 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.targetPath!}" id="targetPath"
                       name="targetPath"
                       required="required" number="true" maxlength='64'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口路径前缀 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.facadeUrlPrefix!}"
                       id="facadeUrlPrefix" name="facadeUrlPrefix"
                       required="required" number="true" maxlength='64'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口文件路径 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.facadeFilePaths!}"
                       id="facadeFilePaths" name="facadeFilePaths"
                       required="required" number="true" maxlength='512'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口参数文件路径列表 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.facadeParamFilePaths!}"
                       id="facadeParamFilePaths" name="facadeParamFilePaths"
                       required="required" number="true" maxlength='512'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口文档输出路径 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.outputPath!}" id="outputPath"
                       name="outputPath"
                       required="required" number="true" maxlength='254'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
                <@PageDict dict_name="generateHeaderParam" dict_desc="是否生成公共请求信息" dict_key="std_zb_yn"
                dict_value="${apiFacadeGenerateConfig.generateHeaderParam!}" dict_type="select"
                label_class="col-sm-2 control-label" dict_class="col-sm-8" required="required" default_value="N"/>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">枚举类匹配格式 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.enumPatterns!}"
                       id="enumPatterns" name="enumPatterns"
                       required="required" number="true" maxlength='64'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">枚举扫描路径 ：</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" value="${apiFacadeGenerateConfig.enumSacnPackage!}"
                       id="enumSacnPackage" name="enumSacnPackage"
                       required="required" number="true" maxlength='64'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    function returnIndex() {
        window.location.href = "/apiFacadeGenerateConfig/query";
    }

    $(function () {
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        // 弹出窗体控制
        ApiFacadeGenerateConfigMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                }
                initAmtAndRate();
            },
            // init end

            // 提交数据
            submitForm: function () {
                Jmts.convertAmtAndRate();//反格式化金额和利率，以防保存出错
                Jmts.ajaxSubmit(document.getElementById("apiFacadeGenerateConfigForm"), function (result) {
                    if (result.success) {
                        if (operation == 'add') {
                            ApiFacadeGenerateConfigMgr.returnIndex();
                        } else {
                            Jmts.succTips(result.msg);
                            window.location.reload();
                        }
                    } else {
                        Jmts.revertAmtAndRate();
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/apiFacadeGenerateConfig/query";
            }
        };
        // 执行初始化
        ApiFacadeGenerateConfigMgr.init();
        // 前台验证表单
        $("#apiFacadeGenerateConfigForm").validate();
    });
</script>
</body>
</html>
